home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / SubdTextureMenu.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  8.3 KB  |  214 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  Aug 28, 1998
  22. //
  23. //  Author:         bkwok
  24. //
  25. //  Description:
  26. //      This implements the "Texture" submenu on the modeling menubar.
  27. //
  28.  
  29. global proc
  30. SubdRequestUVSetName (string $title, string $cmd, string $version, string $args[])
  31. //
  32. //    Procedure Name:
  33. //        SubdRequestUVSetName
  34. //
  35. //    Description:
  36. //        Helper method to ask the user for a new UV set name and then call
  37. //    a command with the name as the final argument.  The command will be
  38. //    called like: $cmd $version $args "uvSetName"
  39. //
  40. //  Input Arguments:
  41. //        string $title            The title for the dialog box
  42. //        string $cmd                The command to issue
  43. //        string $version            Version to pass onto the command
  44. //        string $args            Arguments to pass onto the command
  45. //
  46. //  Return Value:
  47. //      None.
  48. //
  49. {
  50.     string $response = `promptDialog
  51.         -title $title
  52.         -message "UV Set Name:"
  53.         -text "uvSet"
  54.         -button "OK"
  55.         -button "Cancel"
  56.         -defaultButton "OK"
  57.         -cancelButton "Cancel"
  58.         -dismissString "Cancel"`;
  59.     if ($response == "OK") {
  60.         string $name = `promptDialog -query -text`;
  61.         string $execute = ($cmd + " \"" + $version + "\" {");
  62.         string $comma = "";
  63.         for ($arg in $args) {
  64.             $execute += ($comma + "\"" + $arg + "\"");
  65.             $comma = ", ";
  66.         }
  67.         $execute += ("} \"" + $name + "\"");
  68.         eval ($execute);
  69.     }
  70. }
  71.  
  72. global proc
  73. SubdTextureMenu (string $parent, int $creator, string $selectCmd)
  74. //
  75. //    Procedure Name:
  76. //        SubdTextureMenu
  77. //
  78. //    Description:
  79. //        Helper method to generate the menu items for the texture menus
  80. //
  81. //  Input Arguments:
  82. //        string $parent            The name of the parent widget
  83. //        int $creator            Which creator is calling this
  84. //            Current known creators
  85. //                0    Edit Polygons->Textures
  86. //                1    Relationship Editor->Edit->Create UV Set
  87. //        string $selectCmd        The command to issue to determine which objects
  88. //                                    to affect
  89. //
  90. //  Return Value:
  91. //      None.
  92. //
  93. {
  94.     setParent -m $parent;
  95.  
  96. //    string $prefix = ($creator == 0 ? "" : "SubdRequestUVSetName \"Create Planar Mapping\" ");
  97.     string $prefix = ($creator == 0 ? "" : "SubdRequestUVSetName \"Create Planar Mapping\" ");
  98.     string $cmd = $prefix + "performSubdProjectionArgList";
  99.     string $version = "\"1\"";
  100.     string $args0 = ("{\"0\", \"Planar\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}");
  101.     string $args1 = ("{\"1\", \"Planar\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}");
  102.     string $args2 = ("{\"2\", \"Planar\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}");
  103.     string $suffix = ($creator == 0 ? " \"\"" : "");
  104.  
  105.     string $dmc = "performSubdProjectionArgList \"1\" {\"2\", \"Planar\", \"ls -sl\", \"0\"} \"\";";
  106.     string $c = ($cmd + " " + $version + " " + $args0 + $suffix);
  107.     menuItem
  108.         -label ($creator == 1 ? "Planar Mapping..." : "Planar Mapping")
  109.         -ecr true 
  110.         -i "polyPlanProj.xpm"
  111.         -dmc $dmc 
  112.         -ann "Planar Mapping: Create a projection planar to the selected faces"
  113.         -c $c planarMappingItem;
  114.     string $c = ($cmd + " " + $version + " " + $args1 + $suffix);
  115.     menuItem -optionBox 1  
  116.         -i "polyPlanProj.xpm"
  117.         -annotation "Planar Mapping Option Box" 
  118.         -l "Planar Mapping Option Box" -ecr false -c $c planarMappingOptionItem;    
  119. /*    
  120.     string $prefix = ($creator == 0 ? "" : "SubdRequestUVSetName \"Create Cylindrical Mapping\" ");
  121.     string $cmd = $prefix + "performPolyProjectionArgList";
  122.     string $version = "\"1\"";
  123.     string $args0 = ("{\"0\", \"Cylindrical\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}");
  124.     string $args1 = ("{\"1\", \"Cylindrical\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}");
  125.     string $args2 = ("{\"2\", \"Cylindrical\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}");
  126.     string $suffix = ($creator == 0 ? " \"\"" : "");
  127.     string $dmc = "performPolyProjectionArgList \"1\" {\"2\", \"Cylindrical\", \"ls -sl\", \"0\"} \"\";";
  128.     string $c = ($cmd + " " + $version + " " + $args0 + $suffix);
  129.     menuItem
  130.         -label ($creator == 1 ? "Cylindrical Mapping..." : "Cylindrical Mapping")
  131.         -ecr true 
  132.         -i "polyCylProj.xpm"
  133.         -dmc $dmc 
  134.         -ann "Cylindrical Mapping: Create a cylindrical projection on the selected faces"
  135.         -c $c cylindricMappingItem;
  136.     string $c = ($cmd + " " + $version + " " + $args1 + $suffix);
  137.     menuItem -optionBox 1 
  138.         -i "polyCylProj.xpm"
  139.         -annotation "Cylindrical Mapping Option Box" 
  140.         -l "Cylindrical Mapping Option Box" -ecr false -c $c cylindricMappingOptionItem;
  141.     
  142.     string $prefix = ($creator == 0 ? "" : "SubdRequestUVSetName \"Create Spherical Mapping\" ");
  143.     string $cmd = $prefix + "performPolyProjectionArgList";
  144.     string $version = "\"1\"";
  145.     string $args0 = ("{\"0\", \"Spherical\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}");
  146.     string $args1 = ("{\"1\", \"Spherical\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}");
  147.     string $args2 = ("{\"2\", \"Spherical\", \"" + $selectCmd + "\", \"" + ($creator == 1 ? "1" : "0") + "\"}");
  148.     string $suffix = ($creator == 0 ? " \"\"" : "");
  149.     string $c = ($cmd + " " + $version + " " + $args0 + $suffix);
  150.     string $dmc = "performPolyProjectionArgList \"1\" {\"2\", \"Spherical\", \"ls -sl\", \"0\"} \"\";";
  151.     menuItem
  152.         -label ($creator == 1 ? "Spherical Mapping..." : "Spherical Mapping")
  153.         -ecr true 
  154.         -i "polySphereProj.xpm"
  155.         -dmc $dmc
  156.         -ann "Spherical Mapping: Create a spheric projection on the selected faces"
  157.         -c $c sphericMappingItem;
  158.     string $c = ($cmd + " " + $version + " " + $args1 + $suffix);
  159.     menuItem -ob 1 
  160.         -i "polySphereProj.xpm"
  161.         -annotation "Spherical Mapping Option Box" 
  162.         -l "Spherical Mapping Option Box" -ecr false -c $c sphericMappingOptionItem;
  163.  
  164.     //////////////////////////////////////////////////////////////////////
  165.     menuItem -divider true;
  166.  
  167.     if ($creator != 1) {
  168.         menuItem -l "Map UV Border"  -ecr true
  169.             -i "polyMapUVBorder.xpm"
  170.             -ann "Map UV Border: Map the texture border indicated by selected UV to specified shape"
  171.             -ddc "performPolyUntangleUV map 1"
  172.             -dmc "performPolyUntangleUV map 2"
  173.             -c     "MapUVBorder" mapUVBorderItem;
  174.         menuItem -optionBox 1 -i "polyMapUVBorder.xpm" 
  175.                 -annotation "Map UV Border Option Box" 
  176.                 -l "Map UV Border Option Box" -ecr false 
  177.                 -c "performPolyUntangleUV map 1" mapUVBorderOptionItem;
  178.  
  179.         menuItem -l "Relax UVs "  -ecr true
  180.             -i "polyRelaxUVShell.xpm"
  181.             -ann "Relax UVs: Relax the selected UVs"
  182.             -ddc "performPolyUntangleUV relax 1"
  183.             -dmc "performPolyUntangleUV relax 2"
  184.             -c     "RelaxUVShell" relaxUVShellItem;
  185.         menuItem -optionBox 1 -i "polyRelaxUVShell.xpm" 
  186.             -annotation "Relax UVs Option Box" 
  187.             -l "Relax UVs Option Box" -ecr false 
  188.             -c "performPolyUntangleUV relax 1" relaxUVShellOptionItem;
  189.  
  190.     }
  191. */
  192.  
  193.     menuItem -l "Automatic Mapping"
  194.         -ann "Automatic Projection: Select faces to be mapped automatically"
  195.         -c "performSubdAutoProj 0" -i "polyAutoProj.xpm" ;
  196.     menuItem -optionBox 1
  197.         -l "Automatic Projection Option Box"
  198.         -ann "Automatic Projection Option Box"
  199.         -c "performSubdAutoProj 1" -ecr false -i "polyAutoProj.xpm";
  200.  
  201.     //////////////////////////////////////////////////////////////////////
  202.     if ($creator != 1) {
  203.         // menuItem -divider true;
  204.  
  205.  
  206.         menuItem -l "Layout UVs"
  207.             -ann "Layout UVs: Select faces to be moved in UV space"
  208.             -c "performSubdLayoutUV 0" -i "polyLayoutUV.xpm";
  209.         menuItem -optionBox 1
  210.             -l "Layout UVs Option Box" -ann "Layout UVs Option Box"
  211.             -c "performSubdLayoutUV 1" -ecr false -i "polyLayoutUV.xpm";
  212.     }
  213. }
  214.